// import request from '@/utils/request'
import menuListInfo from './../assets/constant/mock/menu'

export function login(username, password) {
  return new Promise((resolve, reject) => {
    let mockData = {
      'data': {'result': true, 'user_id': 3, 'token': 'sit_5e8a63a4-09fa-4979-948c-60c789e31ac2'},
      'success': true
    }
    resolve(mockData)
  })
  // return request({
  //   url: '/user/login',
  //   method: 'post',
  //   data: {
  //     username,
  //     password
  //   }
  // })
}

export function getInfo(token) {
  return new Promise((resolve, reject) => {
    let name = '超级管理员'
    let mockData = { "data": { "role": 2, "name": name }, "success": true }
    resolve(mockData)
  })
  // return request({
  //   url: '/user/info',
  //   method: 'get',
  //   params: { token }
  // })
}

export function logout() {
  return new Promise((resolve, reject) => {
    let mockData = {'data': {}, 'success': true}
    resolve(mockData)
  })
  // return request({
  //   url: '/user/logout',
  //   method: 'post'
  // })
}

export function getMenu(role) {
  return new Promise((resolve, reject) => {

    let roleMenuList = menuListInfo.root; // 该登录角色应该显示的菜单
    let systemAllMenuList = menuListInfo.root; // 该项目的所有菜单
    let serverMenuList = menuListInfo.root; // 服务端记录的该账号的菜单

    let mockData = {
      data: {
        roleMenuList: roleMenuList,
        systemAllMenuList: systemAllMenuList,
        serverMenuList: serverMenuList
      },
      success: true
    }
    console.log(mockData);
    resolve(mockData)
  })
}
